<?php
$mld = MLDnewsletter::getInstance();
$url = $_SERVER['SCRIPT_NAME'] . "?id=mld-newsletter";

if (isset($_GET['delete'])) {
    $msg = remove_letter($_GET['delete']);
    display_message($msg[0], $msg[1]);
}
$xml = $mld->getXmlData('newsletters');
?>
    <h3><?php i18n('mld-newsletter/MANAGELETTERS'); ?></h3>
    <div class="edit-nav" ><p><a href="<?php echo $url; ?>&editletter=<new>"><?php i18n('mld-newsletter/NEWLETTER'); ?></a></p></div>
    <table id="newsletters" class="edittable highlight">
            <tr>
            <th><?php i18n('mld-newsletter/LETTERTITLE'); ?></th>
            <th><?php i18n('mld-newsletter/ALREADYSEND'); ?></th>
            <th></th>
            <th></th>
        </tr>
<?php
foreach ($xml as $letter) {
    echo '<tr><td><a href="' . $url . '&editletter=' . $letter->id . '">' . $letter->title . '</a></td>';
    if ($letter->send == 'true') {
        $status = 'true';
    } else {
        $status = 'false';
    }
    echo '<td><img alt="" src="../plugins/mld-newsletter/images/' . $status . '.png" /></td>';
    echo '<td class="secondarylink"><a href="' . $url . '&viewletter=' . $letter->id . '">#</a></td>';
    echo '<td class="delete"><a href="' . $_SERVER['REQUEST_URI'] . '&delete=' . $letter->id . '">×</a></td></tr>';
}
?> 
    </table>